import csv
import pandas as pd
df = pd.read_csv('药品生产企业.csv')
# 行遍历
count = 0
for index, row in df.iterrows():
    # 写csv
    with open("result1.csv", 'a+', encoding="utf-8-sig", newline='') as f1:
        add1 = ""
        add2 = ""
        count += 1
        if pd.isna(row[9]) is False:
            tmp1 = row[9].split("***")
            for t1 in tmp1:
                add1 += t1.split("：")[0]
        if pd.isna(row[10]) is False:
            tmp2 = row[10].split("***")
            for t2 in tmp2:
                add2 += t2.split("：")[-1]
        csv_writer = csv.writer(f1)
        csv_writer.writerow([row[1], row[4], row[5], row[6], row[7], row[8], add1,
                             add2, row[11], row[12]])
        print(f"===={count}=====")